import React from 'react';
import { Button, Modal, message } from 'antd';
import { inject, observer } from 'mobx-react';
import { toJS } from "mobx"
import { WeaRightMenu, WeaReqTop, WeaNewScroll, WeaTools, WeaAlertPage, WeaDialog, WeaBrowser, WeaLocaleProvider } from "ecCom"
import { WeaTableNew } from 'comsMobx';
const WeaTable = WeaTableNew.WeaTable;
const getLabel = WeaLocaleProvider.getLabel;
import RelareExchange from '../common/relateExchange'
import TabDiscuss from '../common/TabDiscuss'
import RelateWorkFlow from '../common/relateWorkFlow'
import RelateDocument from "../common/relateDocument"
import TaskSub from '../common/taskSub'
import TaskShare from '../common/sharePage'
import TaskInfo from '../common/taskInfo'
import RealteCrmDialog from '../dialog/relateCrmDialog'
import ProjectLogDialog from "../dialog/modifyLogDialog"
import ProjectFieldLogDialog from '../dialog/projectFieldLogDialog';
import ProjectFieldDetailLogDialog from '../dialog/ProjectFieldDetailLogDialog';


@inject('taskCardStore')
@observer
class TaskCard extends React.Component {
    componentDidMount() {
        const { taskCardStore, location: { query } } = this.props;
        const { getTaskForm, getTaskTabs, setIsNow } = taskCardStore;
        setIsNow(query.isNow);
        getTaskTabs(query);
        
    }
    componentWillUnmount() {

    }

    render() {
        const { taskCardStore } = this.props;
        const { tabDatas, selectTabKey, loading, taskname, shareStore, hasRight, verified, form, taskid, saveAndReLoadWf, taskLogTableStore, taskFieldLogTableStore, taskFieldDetailLogTableStore, fieldname } = taskCardStore;
        if (verified && !hasRight) {
            return (<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@57yw9e`} >
                <div style={{ color: '#000' }}>
                    {getLabel(2012, "对不起，您暂时没有权限！")}
                </div>
            </WeaAlertPage>
            )
        }
        if (verified && hasRight) {
            const tabDatas1 = toJS(tabDatas);
            let _this = this;
            let tabUrl = function (key) {
                if (tabDatas1) {
                    for (let i = 0; i < tabDatas1.length; i++) {
                        if (tabDatas1[i].id == key && tabDatas1[i].shortname == "taskinfo") {
                            return  <div style={{ height: '100%' }}>
                                     <TaskInfo ecId={`${this && this.props && this.props.ecId || ''}_TaskInfo@eq5dmb`} listStore={taskCardStore} form={form} />
                                    < ProjectLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectLogDialog@anwaqj`} ref="taskLogDialog" title={getLabel('83926','任务日志') } tableStore={taskLogTableStore} store={taskCardStore} />
                                     <ProjectFieldLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectFieldLogDialog@werop5`} title={getLabel('82274','字段日志') } tableStore={taskFieldLogTableStore} store={taskCardStore} />
                                     <ProjectFieldDetailLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectFieldDetailLogDialog@rg85jp`} title={getLabel('82274','字段日志')+"-"+fieldname } tableStore={taskFieldDetailLogTableStore} store={taskCardStore} />
                                     </div>
                        } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "tasksub") {
                            return  <div style={{ height: '100%' }}><TaskSub ecId={`${this && this.props && this.props.ecId || ''}_TaskSub@nw8ws6`} contentStore={taskCardStore} /></div>
                        } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "exchange") {
                            return  <div style={{ height: '100%' }}><TabDiscuss ecId={`${this && this.props && this.props.ecId || ''}_TabDiscuss@i74ity`} contentStore={taskCardStore} sortid={taskid} /></div>
                        } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "taskshare") {
                            return  <div style={{ height: '100%' }}><TaskShare ecId={`${this && this.props && this.props.ecId || ''}_TaskShare@76k09q`} contentStore={taskCardStore} shareCondition={shareStore.shareCondition} title={getLabel(83973, "添加任务共享")} /></div>
                        } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "req") {
                            return  <div style={{ height: '100%' }}><RelateWorkFlow ecId={`${this && this.props && this.props.ecId || ''}_RelateWorkFlow@gay3i8`} contentStore={taskCardStore} /></div>
                        } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "doc") {
                            return  <div style={{ height: '100%' }}><RelateDocument ecId={`${this && this.props && this.props.ecId || ''}_RelateDocument@iz3snx`} contentStore={taskCardStore} addDocFn={_this.addDocFn}/></div>
                        } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "crm") {
                            return  <div style={{ height: '100%' }}>{_this.getReleateCrmOrCpt("crm")}<RealteCrmDialog ecId={`${this && this.props && this.props.ecId || ''}_RealteCrmDialog@uwy1v8`} contentStore={taskCardStore} /></div>
                        } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "cpt") {
                            return  <div style={{ height: '100%' }}> {_this.getReleateCrmOrCpt("cpt")}
                            <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@p0hme1`} type={"23"} title={getLabel(535, "资产")} ref={"addCpt"} fieldName={"addCpt"} onChange={(ids, names, datas) => _this.addCapital(ids, names, datas)} customized={true} hasAdvanceSerach={true}>
                            </WeaBrowser></div>
                        } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "") {
                            if (tabDatas[i].linkurl.indexOf("noright") > -1) {
                                return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@yo0s3f`} >
                                    <div style={{ color: '#000' }}>
                                        {getLabel(2012, "对不起，您暂时没有权限！")}
                                    </div>
                                </WeaAlertPage>
                            } else {
                                return tabDatas1[i].linkurl;
                            }
                        }
                    }
                    return ""
                }
            }(selectTabKey);
            return (
                <div ref="box">
                    <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@xxgdht`} datas={this.getRightMenu()} onClick={this.onRightMenuClick.bind(this)}>
                        <WeaReqTop ecId={`${this && this.props && this.props.ecId || ''}_WeaReqTop@in5tqj`}
                            title={taskname}
                            loading={loading}
                            icon={<i className='icon-coms-project' />}
                            iconBgcolor='#217346'
                            buttons={this.getButtons()}
                            buttonSpace={10}
                            showDropIcon={true}
                            dropMenuDatas={this.getRightMenu()}
                            onDropMenuClick={this.onRightMenuClick.bind(this)}
                            tabDatas={tabDatas}
                            selectedKey={selectTabKey}
                            onChange={this.taskCardChangeTab.bind(this)}
                        >
                            <div className="prj-req-content">
                                <div className='prj-req-content-inner'>
                                    <WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@6e2lrz`} scrollId='prj-req-content-main-scroll' height='100%'>
                                    {
                                            typeof tabUrl === "object" ? tabUrl :
                                                <iframe src={tabUrl} id="prjtabiframe" name="prjtabiframe" className="flowFrame" frameborder="0" width="100%" height="100%" />
                                        }
                                    </WeaNewScroll>
                                </div>
                            </div>
                        </WeaReqTop>
                    </WeaRightMenu>
                </div>
            )
        }
        return (<div></div>)
    }
    getReleateCrmOrCpt(type) {
        const { taskRelRight: { hasRight, verified }, taskCrmStore, taskCptStore } = this.props.taskCardStore;
        if (verified && !hasRight) {
            return (<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@08pfzy`} >
                <div style={{ color: '#000' }}>
                    {getLabel(2012, "对不起，您暂时没有权限！")}
                </div>
            </WeaAlertPage>
            )
        }
        if (verified && hasRight) {
            if (type == "crm") {
                return <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@12nf9a`}
                    comsWeaTableStore={taskCrmStore}
                    hasOrder={true}
                    needScroll={true}
                    onOperatesClick={this.onCrmOperatesClick.bind(this)}
                />
            }
            if (type == "cpt") {
                return <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@cdpen9`}
                    comsWeaTableStore={taskCptStore}
                    hasOrder={true}
                    needScroll={true}
                    onOperatesClick={this.onCptOperatesClick.bind(this)}
                />
            }
        }
        return <div></div>
    }
    getButtons() {
        const { taskCardStore } = this.props;
        const { rightMenu, taskid, selectTabKey, taskInfoStore, prjid, shareTableStore, taskCptStore, taskCrmStore, tabDatas, canSave , setCanSave } = taskCardStore;
        let btnArr = [];
        let that = this;
        const tabDatas1 = toJS(tabDatas);
        rightMenu && rightMenu.length > 0 && rightMenu.map(m => {
            let disabled = false;
            if (tabDatas1) {
                for (let i = 0; i < tabDatas1.length; i++) {
                    if (tabDatas1[i].shortname == "taskshare" && tabDatas1[i].key == selectTabKey) {
                        let { selectedRowKeys } = shareTableStore;
                        disabled = selectedRowKeys.length == 0 ? true : false;
                    } else if (tabDatas1[i].shortname == "cpt" && tabDatas1[i].key == selectTabKey) {
                        let { selectedRowKeys } = taskCptStore;
                        disabled = selectedRowKeys.length == 0 ? true : false;
                    } else if (tabDatas1[i].shortname == "crm" && tabDatas1[i].key == selectTabKey) {
                        let { selectedRowKeys } = taskCrmStore;
                        disabled = selectedRowKeys.length == 0 ? true : false;
                    } else if (tabDatas1[i].shortname == "taskinfo" && tabDatas1[i].key == selectTabKey) {
                        disabled = canSave ? false : true;
                    } 
                }
            }
            // if (selectTabKey == 'taskshare') {
            //     let { selectedRowKeys } = shareTableStore;
            //     disabled = selectedRowKeys.length == 0 ? true : false;
            // } else if (selectTabKey == 'cpt') {
            //     let { selectedRowKeys } = taskCptStore;
            //     disabled = selectedRowKeys.length == 0 ? true : false;
            // } else if (selectTabKey == 'crm') {
            //     let { selectedRowKeys } = taskCrmStore;
            //     disabled = selectedRowKeys.length == 0 ? true : false;
            // } else {
            //     disabled = false;
            // }
            m.isTop == '1' && btnArr.length < 4 && btnArr.push(
                <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@sbf17q@${m.type}`} type="primary"
                    disabled={(m.type == "BTN_DELETEBATCH"||m.type == "BTN_SAVE") ? disabled : false}
                    onClick={() => {
                        let fn = m.menuFun.indexOf('this') >= 0 ? `${m.menuFun.split('this')[0]})` : m.menuFun;
                        if (tabDatas1) {
                            for (let i = 0; i < tabDatas1.length; i++) {
                                
                                if (tabDatas1[i].shortname == "taskinfo" && tabDatas1[i].key == selectTabKey) {
                                    if (m.type == "BTN_EDIT") { //编辑
                                        taskCardStore.getTaskForm({ viewtype: 'edit', taskid: taskid });
                                    } else if (m.type == "BTN_SAVE") {  //保存
                                        setCanSave(false);
                                        taskCardStore.saveTaskInfo({ taskid: taskid });
                                    } else if (m.type == "BTN_DELETE") {  //删除
                                        taskCardStore.delTask("del", taskid);
                                    } else if (m.type == "BTN_BACK") {  //返回
                                        taskCardStore.getTaskForm({ viewtype: 'view', taskid: taskid });
                                    }
                                } else  if (tabDatas1[i].shortname == "cpt" && tabDatas1[i].key == selectTabKey) {
                                    if (m.type == "BTN_APPEND") { //添加
                                        this.refs.addCpt.openModal();
                                    } else if (m.type == "BTN_DELETEBATCH") {  //删除
                                        this.deleteCrmOrCpt('cpt');
                                    }
                                } else  if (tabDatas1[i].shortname == "crm" && tabDatas1[i].key == selectTabKey) {
                                    if (m.type == "BTN_APPEND") { //添加
                                        taskCardStore.handleRelateCrmDialog(true, "add", {
                                            crmid: { value: '', valueSpan: '', valueObj: [] },
                                            reasondesc: { value: "" }
                                        });
                                    } else if (m.type == "BTN_DELETEBATCH") {  //删除
                                        this.deleteCrmOrCpt('crm');
                                    }
                                } else  if (tabDatas1[i].shortname == "req" && tabDatas1[i].key == selectTabKey) {
                                    if (m.type == "BTN_NEWREQ") {
                                        //console.log("新建流程")
                                        this.openFullWindow("/spa/workflow/static/index.html#/main/workflow/add?openNewWindow=0&taskid=" + taskid);
                                    }
                                } else  if (tabDatas1[i].shortname == "doc" && tabDatas1[i].key == selectTabKey) {
                                    if (m.type == "BTN_NEWDOC") {
                                        //console.log("新建文档")
                                        this.openFullWindow('/spa/document/static/index.html#/main/document/add?openNewWindow=0&moudleFrom=task');
                                        let _this = this;
                                        window.__createDocFn = function (obj) {
                                            let docid = obj.docid;
                                            let docsubject = obj.docSubject;
                                            // console.log(docid,docsubject);
                                            _this.addDocument(docid,docsubject,'');
                                        }
                                    }
                                } else  if (tabDatas1[i].shortname == "taskshare" && tabDatas1[i].key == selectTabKey) {
                                    if (m.type == "BTN_APPEND") { //添加
                                        taskCardStore.showAddShareModal(true);
                                    } else if (m.type == "BTN_DELETEBATCH") {  //删除
                                        let { selectedRowKeys } = shareTableStore;
                                        taskCardStore.delBatchShare(`${toJS(selectedRowKeys)}`);
                                    }
                                }
                            }
                            if(m.type == "BTN_NEWSUB"){ //添加子任务
                                taskInfoStore.handleDialog(true,"add",taskid,{prjid:prjid,parentid:taskid});   
                             }
                        }
                        
                    }}>
                    {m.menuName}
                </Button>
            );
        });
        return btnArr;
    }
    getRightMenu() {
        const { taskCardStore } = this.props;
        const { rightMenu, selectTabKey, shareTableStore, taskCptStore, taskCrmStore, tabDatas, canSave } = taskCardStore;
        let btnArr = [];
        const tabDatas1 = toJS(tabDatas);
        rightMenu && rightMenu.length > 0 && rightMenu.map(m => {
            let disabled = false;
            if (tabDatas1) {
                for (let i = 0; i < tabDatas1.length; i++) {
                    if (tabDatas1[i].shortname == "taskshare" && tabDatas1[i].key == selectTabKey) {
                        let { selectedRowKeys } = shareTableStore;
                        disabled = selectedRowKeys.length == 0 ? true : false;
                    } else if (tabDatas1[i].shortname == "cpt" && tabDatas1[i].key == selectTabKey) {
                        let { selectedRowKeys } = taskCptStore;
                        disabled = selectedRowKeys.length == 0 ? true : false;
                    } else if (tabDatas1[i].shortname == "crm" && tabDatas1[i].key == selectTabKey) {
                        let { selectedRowKeys } = taskCrmStore;
                        disabled = selectedRowKeys.length == 0 ? true : false;
                    } else if (tabDatas1[i].shortname == "taskinfo" && tabDatas1[i].key == selectTabKey) {
                        disabled = canSave ? false : true;
                    } 
                }
            }
            btnArr.push({
                icon: <i className={m.menuIcon} />,
                content: m.menuName,
                disabled: (m.type == "BTN_DELETEBATCH"||m.type == "BTN_SAVE") ? disabled : false
            })
        });
        return btnArr
    }
    onRightMenuClick(key) {
        const { taskCardStore } = this.props;
        const { rightMenu, taskid, selectTabKey, taskInfoStore, prjid, shareTableStore, tabDatas, setCanSave } = taskCardStore;
        let that = this;
        const tabDatas1 = toJS(tabDatas);
        rightMenu && rightMenu.length > 0 && rightMenu.map((m, i) => {
            if (Number(key) == i) {
                if (tabDatas1) {
                    for (let i = 0; i < tabDatas1.length; i++) {
                        if (tabDatas1[i].shortname == "taskinfo" && tabDatas1[i].key == selectTabKey) {
                            if (m.type == "BTN_EDIT") { //编辑
                                taskCardStore.getTaskForm({ viewtype: 'edit', taskid: taskid });
                            } else if (m.type == "BTN_SAVE") {  //保存
                                setCanSave(false);
                                taskCardStore.saveTaskInfo({ taskid: taskid });
                            } else if (m.type == "BTN_DELETE") {  //删除
                                taskCardStore.delTask("del", taskid);
                            } else if (m.type == "BTN_BACK") {  //返回
                                taskCardStore.getTaskForm({ viewtype: 'view', taskid: taskid });
                            } else if (m.type == "BTN_LOG") {  //日志
                                this.refs.taskLogDialog.setVisible(true);
                                taskCardStore.getTaskLogList({ prjid:taskCardStore.prjid,taskid: taskid });
                            }
                        } else  if (tabDatas1[i].shortname == "cpt" && tabDatas1[i].key == selectTabKey) {
                            if (m.type == "BTN_APPEND") { //添加
                                this.refs.addCpt.openModal();
                            } else if (m.type == "BTN_DELETEBATCH") {  //删除
                                this.deleteCrmOrCpt('cpt');
                            }
                        } else  if (tabDatas1[i].shortname == "crm" && tabDatas1[i].key == selectTabKey) {
                            if (m.type == "BTN_APPEND") { //添加
                                taskCardStore.handleRelateCrmDialog(true, "add", {
                                    crmid: { value: '', valueSpan: '', valueObj: [] },
                                    reasondesc: { value: "" }
                                });
                            } else if (m.type == "BTN_DELETEBATCH") {  //删除
                                this.deleteCrmOrCpt('crm');
                            }
                        } else  if (tabDatas1[i].shortname == "req" && tabDatas1[i].key == selectTabKey) {
                            if (m.type == "BTN_NEWREQ") {
                                //console.log("新建流程")
                                this.openFullWindow("/spa/workflow/static/index.html#/main/workflow/add?openNewWindow=0&taskid=" + taskid);
                            }
                        } else  if (tabDatas1[i].shortname == "doc" && tabDatas1[i].key == selectTabKey) {
                            if (m.type == "BTN_NEWDOC") {
                                //console.log("新建文档")
                                this.openFullWindow('/spa/document/static/index.html#/main/document/add?openNewWindow=0&moudleFrom=task');
                                let _this = this;
                                window.__createDocFn = function (obj) {
                                    let docid = obj.docid;
                                    let docsubject = obj.docSubject;
                                    // console.log(docid,docsubject);
                                    _this.addDocument(docid,docsubject,'');
                                }
                            }
                        } else  if (tabDatas1[i].shortname == "taskshare" && tabDatas1[i].key == selectTabKey) {
                            if (m.type == "BTN_APPEND") { //添加
                                taskCardStore.showAddShareModal(true);
                            } else if (m.type == "BTN_DELETEBATCH") {  //删除
                                let { selectedRowKeys } = shareTableStore;
                                taskCardStore.delBatchShare(`${toJS(selectedRowKeys)}`);
                            }
                        }
                    }
                }
              
                if (m.type == "BTN_NEWSUB") { //添加子任务
                    taskInfoStore.handleDialog(true, "add", taskid, { prjid: prjid, parentid: taskid });
                } else if (m.type == "BTN_COLUMN") { //定制列
                    taskCardStore.onShowColumn();
                }
            }
        });
    }
    addDocFn = (docid,docsubject) =>{
        // console.log(docid,docsubject);
    }
    taskCardChangeTab(key) {
        const { taskCardStore } = this.props;
        taskCardStore.changeTab(key);
    }
    cancelShare = () => {
        const { taskCardStore } = this.props;
        taskCardStore.showTaskShare(false);
    }
    saveShare = () => {
        const { taskCardStore } = this.props;
        taskCardStore.showTaskShare(false);
    }
    reloadExchanges = () => {
        const { taskCardStore } = this.props;
        taskCardStore.getRelateExchangeInfo();
    }
    deleteCrmOrCpt = (type) => {
        const { taskCardStore } = this.props;
        const { taskid, doDspTaskReferenceOpt, taskCrmStore, taskCptStore } = taskCardStore;
        const { selectedRowKeys } = (type == "cpt" ? taskCptStore : taskCrmStore);
        if (selectedRowKeys.length > 0) {
            Modal.confirm({
                title: getLabel(15172, "系统提示"),
                content: getLabel(83601, "您确认要删除选中的记录吗？"),
                onOk() {
                    doDspTaskReferenceOpt({
                        dotype: type,
                        method: 'del',
                        prjid: "",
                        taskid: taskid,
                        ids: `${toJS(selectedRowKeys)}`
                    }, type)
                },
                onCancel() { },
            })
        } else {
            // Modal.warning({
            //     title: getLabel(15172,"系统提示"),
            //     content: getLabel(84093,"请至少选择一条记录！"),
            // })
            message.error(getLabel(84093, "请至少选择一条记录！"));
        }
    }
    //资产操作按钮
    onCrmOperatesClick = (record, index, operate, flag) => {
        let _href = operate && operate.href ? operate.href : "";
        let fn = _href.replace("javascript:", "");
        fn = fn.substring(0, fn.indexOf('('));
        const { taskCardStore } = this.props;
        const { doDspTaskReferenceOpt, taskid, taskDocStore } = taskCardStore;
        if (fn != "") {
            if ("onDelRelated" == fn) {  //delete
                Modal.confirm({
                    title: getLabel(15172, "系统提示"),
                    content: getLabel(83600, "您确认要删除吗？"),
                    onOk() {
                        doDspTaskReferenceOpt({
                            dotype: 'crm',
                            method: 'del',
                            prjid: "",
                            taskid: taskid,
                            ids: record.randomFieldId
                        }, 'crm')
                    },
                    onCancel() { },
                })
            } else if ("onEdit" == fn) {  //编辑
                taskCardStore.setRelateCrmUpdateID(record.randomFieldId);
                taskCardStore.handleRelateCrmDialog(true, "edit", {
                    crmid: {
                        value: record.customerid,
                        valueSpan: record.customeridspan,
                        valueObj: [{ id: record.customerid, name: record.customeridspan, }],
                    },
                    reasondesc: { value: record.reasondesc }
                });
            }
        }
    }
    //资产操作按钮
    onCptOperatesClick = (record, index, operate, flag) => {
        let _href = operate && operate.href ? operate.href : "";
        let fn = _href.replace("javascript:", "");
        fn = fn.substring(0, fn.indexOf('('));
        const { taskCardStore } = this.props;
        const { doDspTaskReferenceOpt, taskid, taskDocStore } = taskCardStore;
        if (fn != "") {
            if ("onDelRelated" == fn) {  //delete
                Modal.confirm({
                    title: getLabel(15172, "系统提示"),
                    content: getLabel(83600, "您确认要删除吗？"),
                    onOk() {
                        doDspTaskReferenceOpt({
                            dotype: 'cpt',
                            method: 'del',
                            prjid: "",
                            taskid: taskid,
                            ids: record.randomFieldId
                        }, 'cpt')
                    },
                    onCancel() { },
                })
            }
        }
    }
    //资产新建
    addCapital = (ids, name, data) => {
        const { taskCardStore } = this.props;
        const { doDspTaskReferenceOpt, taskid, prjid } = taskCardStore;
        doDspTaskReferenceOpt({
            dotype: 'cpt',
            method: 'add',
            prjid: prjid,
            taskid: taskid,
            cptid: ids
        }, 'cpt');
    }

    openFullWindow = (url) => {
        const width = screen.availWidth - 10;
        const height = screen.availHeight - 50;
        let szFeatures = 'top=0,';
        szFeatures += 'left=0,';
        szFeatures += `width=${width},`;
        szFeatures += `height=${height},`;
        szFeatures += 'directories=no,';
        szFeatures += 'status=yes,toolbar=no,location=no,';
        szFeatures += 'menubar=no,';
        szFeatures += 'scrollbars=yes,';
        szFeatures += 'resizable=yes';
        window.open(url, '', szFeatures);
    }

    //新建
    addDocument=(ids, names, datas)=>{
        const {taskCardStore} = this.props;
        const {doDspTaskReferenceOpt,taskid,prjid} = taskCardStore;
        doDspTaskReferenceOpt({
            dotype:'doc',
            method:'add',
            prjid : prjid,
            taskid:taskid,
            docid:ids,
            ids:""
        },'doc')
    }

     addWorkFlow=(ids, names, datas)=>{
        const {taskCardStore} = this.props;
        const {doDspTaskReferenceOpt,taskid,prjid} = taskCardStore;
        doDspTaskReferenceOpt({
            dotype:'doc',
            method:'add',
            prjid : prjid,
            taskid:taskid,
            docid:ids,
            ids:""
        },'doc')
    }
}

export default TaskCard;